import * as types from './mutation-types'
import   {babyShow,CityList,Query,Express,ExpressQuery} from '../http/api'




const actions= {
  // 萌宝列表
  async babyShow({ commit, state }) {
      let data= await babyShow();
      if(data.success){
        commit(types.SET_OPEN_ID,data.data)
      }
      else{
        alert(data.msg)
      }

  },
  // 历史天气
  async CityList({ commit, state }) {

      let data= await CityList();

       if(data.reason){
         commit(types.CITY_LIST,data.result)
       }
       else{

       }

  },
  // 根据汉字查询相关信息，如拼音、读音、详解、五笔等
  async query({ commit, state },size) {
       console.log(size)
    let data= await Query(size);
     console.log(data)
    // if(data.reason){
    //   commit(types.CITY_LIST,data.result)
    // }
    // else{
    //
    // }

  },

      // 快递公司列表
  async express({ commit, state }) {
    let data= await Express();
     if(data.resultcode=="200"){
      commit(types.EXPRESS,data.result)
    }
    else{

    }

  },
  // 快递查询结果
  async expressQuery({ commit, state },query) {
    // 764754043647

    let data= await ExpressQuery(query.com,query.no);

    if(data.resultcode=="200"){
      commit(types.QUERYRESULT,data.result)
    }
    else{

    }

  }




}


export default actions
